package client.controller;

import java.io.File;

import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;

public class ExplorerClientController extends AbstractController implements TreeSelectionListener {

	public ExplorerClientController(MainController mc)
	{
		super(mc);
	}

	@Override
	public void valueChanged(TreeSelectionEvent evArg)
	{
		File selectedFile = (File) super.getMainWindow().get_clientExplorer().getLastSelectedPathComponent();
		if (selectedFile != null)
		{
			super.getMainWindow().get_TF_currentPath().setText(selectedFile.getAbsolutePath());
		}
	}

	@Override
	public boolean isValid()
	{
		return (new File(super.getMainWindow().get_TF_currentPath().getText())).exists();
	}

}
